#include "Solution.h"
Solution::Solution(std::vector<std::string> words) : graph(words){
}

bool Solution::checkCircle() {
    return graph.hasCircle();
}

int Solution::genAllChain(std::vector<std::string> &result) {
    if (checkCircle()) return -1;
    return graph.genAllChain(result);

}

int Solution::genMaxWordChain(std::vector<std::string> &result, char head, char tail, bool allowCircle) {
    if (allowCircle){
        return graph.genMaxWordChainWithCircle(result,head,tail);

    }
    else {
        if (checkCircle()) return -1;
        return graph.genMaxWordChain(result,head,tail);
    }
}

int Solution::genMaxWordChainNotSame(std::vector<std::string> &result) {
    if (checkCircle()) return -1;
    return graph.genMaxWordChainNotSame(result);
}

int Solution::genMaxCharChain(std::vector<std::string> &result, char head, char tail, bool allowCircle) {
    if (allowCircle){
        return graph.genMaxCharChainWithCircle(result,head,tail);

    }
    else {
        if (checkCircle()) return -1;
        return graph.genMaxCharChain(result,head,tail);
    }
}


